12. Errors and Exceptions
SOLUTION:
- Any syntax error can be detected before running your program.
- An exception occurs during run time.
- There are many types of exceptions.
QUIZ QUESTION: :
Here are some of the common exceptions programmers run into in Python. Do some research online to match the appropriate description for each.
ANSWER CHOICES:
Built-in Exception |
Description |
---|---|
An object of an unsupported type is passed as input to an operation or function. |
|
A sequence subscript is out of range. |
|
An assert statement fails. |
|
A key can't be found in a dictionary. |
|
An object of the correct type but inappropriate value is passed as input to a built-in operation or function. |
SOLUTION:
Built-in Exception |
Description |
---|---|
An object of an unsupported type is passed as input to an operation or function. |
|
A sequence subscript is out of range. |
|
An assert statement fails. |
|
A key can't be found in a dictionary. |
|
An object of the correct type but inappropriate value is passed as input to a built-in operation or function. |